package homework.exp05;

import java.io.File;
import java.io.FileInputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class E {

    static Scanner cin = null;

    static {
        try {
            cin = new Scanner(new FileInputStream(new File("E.in")));
        } catch (Exception e) {
            cin = new Scanner(System.in);
        }
    }

    static Map<Character, Integer> map = new HashMap<Character, Integer>();

    static void fillMap() {
        map.put('A', 2);
        map.put('B', 2);
        map.put('C', 2);
        map.put('D', 3);
        map.put('E', 3);
        map.put('F', 3);
        map.put('G', 4);
        map.put('H', 4);
        map.put('I', 4);
        map.put('J', 5);
        map.put('K', 5);
        map.put('L', 5);
        map.put('M', 6);
        map.put('N', 6);
        map.put('O', 6);
        map.put('P', 7);
        map.put('R', 7);
        map.put('S', 7);
        map.put('T', 8);
        map.put('U', 8);
        map.put('V', 8);
        map.put('W', 9);
        map.put('X', 9);
        map.put('Y', 9);

    }

    static String decode(String s) {
        StringBuffer buffer = new StringBuffer();
        for (char c : s.toUpperCase().toCharArray()) {
            if ("0123456789".contains(c + "")) buffer.append(c);
            else if (map.containsKey(c)) buffer.append(map.get(new Character(c)));
        }
        String st = buffer.toString();
        return st.substring(0, 3) + "-" + st.substring(3);
    }

    public static void main(String[] args) {
        fillMap();//先把转换表填好
        while (cin.hasNext()) {
            int n = cin.nextInt();
            Map<String, Integer> fMap = new TreeMap<>();
            for (int i = 0; i < n; i++) {
                String s = cin.next();
                String string = decode(s);//将输入的符号串解码为电话号码
                System.err.println(s + "=>" + string);//利用System.err流进行调试
                if (fMap.containsKey(string)) fMap.put(string, fMap.get(string) + 1);
                else fMap.put(string, 1);
            }
            if (fMap.size() == n) System.out.println("No duplicates.");
            else {
                for (String key : fMap.keySet())
                    if (fMap.get(key) > 1) System.out.println(key + " " + fMap.get(key));
            }
        }
    }


}